﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FileConvert
{
    public class FileConvertFactory
    {
        /// <summary>
        /// 建立一个文件转换对象
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public IFileConvert CreateFileConvert(string type)
        {
            try
            {
                return (IFileConvert)System.Reflection.Assembly.Load("FileConvert")
                    .CreateInstance("FileConvert." + type.ToUpper() + "Convert");
            }
            catch (Exception ex)
            {

                throw new ArgumentException("没有提供此类型的转换" + ex.Message);
            }
        }

    }
}
